package com.md.youyouhui.view;

import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.ViewModel;

import com.md.youyouhui.common.Resource;
import com.md.youyouhui.net.repo.AddAddressRepo;
import com.md.youyouhui.net.repo.BindCardRepo;
import com.md.youyouhui.net.repo.CardNumRepo;
import com.md.youyouhui.net.repo.CodeRepo;
import com.md.youyouhui.net.repo.CouponAvailableRepo;
import com.md.youyouhui.net.repo.CouponRepo;
import com.md.youyouhui.net.repo.DelAddressRepo;
import com.md.youyouhui.net.repo.DelCardRepo;
import com.md.youyouhui.net.repo.DirectPayRepo;
import com.md.youyouhui.net.repo.ForgotRepo;
import com.md.youyouhui.net.repo.GetAddressRepo;
import com.md.youyouhui.net.repo.GetDefaultAddressRepo;
import com.md.youyouhui.net.repo.GetLimitSellRepo;
import com.md.youyouhui.net.repo.GetSellRepo;
import com.md.youyouhui.net.repo.GetShoppingDetailsRepo;
import com.md.youyouhui.net.repo.GetShoppingInfoRepo;
import com.md.youyouhui.net.repo.GetShoppingOrdersRepo;
import com.md.youyouhui.net.repo.GetSlideRepo;
import com.md.youyouhui.net.repo.GetTypeRepo;
import com.md.youyouhui.net.repo.HomeMealNewRepo;
import com.md.youyouhui.net.repo.HomeMealRepo;
import com.md.youyouhui.net.repo.HomeNewsRepo;
import com.md.youyouhui.net.repo.IndexRepo;
import com.md.youyouhui.net.repo.InvitePeopleRepo;
import com.md.youyouhui.net.repo.LoginRepo;
import com.md.youyouhui.net.repo.LogoutAccountRepo;
import com.md.youyouhui.net.repo.MobileNickNameRepo;
import com.md.youyouhui.net.repo.MobilePhoneRepo;
import com.md.youyouhui.net.repo.MobilePwdRepo;
import com.md.youyouhui.net.repo.NoticeRepo;
import com.md.youyouhui.net.repo.OilInfoRepo;
import com.md.youyouhui.net.repo.OrderConfrimRepo;
import com.md.youyouhui.net.repo.OrderDetailRepo;
import com.md.youyouhui.net.repo.OrderInfoRepo;
import com.md.youyouhui.net.repo.PayMealRepo;
import com.md.youyouhui.net.repo.PayMoneyMealRepo;
import com.md.youyouhui.net.repo.PayMoneyRepo;
import com.md.youyouhui.net.repo.QuestionRepo;
import com.md.youyouhui.net.repo.ReceiveCardRepo;
import com.md.youyouhui.net.repo.ShoppingPayRepo;
import com.md.youyouhui.net.repo.ShowRepo;
import com.md.youyouhui.net.repo.UserCardRepo;
import com.md.youyouhui.net.repo.UserHeadRepo;
import com.md.youyouhui.net.repo.UserInfoRepo;
import com.md.youyouhui.net.repo.UserRepo;
import com.md.youyouhui.net.response.CodeResponse;
import com.md.youyouhui.net.response.CouponAvailableResponse;
import com.md.youyouhui.net.response.CouponResponse;
import com.md.youyouhui.net.response.DirectPayResponse;
import com.md.youyouhui.net.response.GetAddressResponse;
import com.md.youyouhui.net.response.GetCardNumResponse;
import com.md.youyouhui.net.response.GetHomeMealNewResponse;
import com.md.youyouhui.net.response.GetHomeMealResponse;
import com.md.youyouhui.net.response.GetLimitSellResponse;
import com.md.youyouhui.net.response.GetOilInfoResponse;
import com.md.youyouhui.net.response.GetOrderInfoResponse;
import com.md.youyouhui.net.response.GetSellResponse;
import com.md.youyouhui.net.response.GetShoppingDetailsResponse;
import com.md.youyouhui.net.response.GetShoppingInfoResponse;
import com.md.youyouhui.net.response.GetSlideResponse;
import com.md.youyouhui.net.response.GetTypeResponse;
import com.md.youyouhui.net.response.HomeNewsResponse;
import com.md.youyouhui.net.response.IndexResponse;
import com.md.youyouhui.net.response.LoginResponse;
import com.md.youyouhui.net.response.NoticeResponse;
import com.md.youyouhui.net.response.OrderDetailResponse;
import com.md.youyouhui.net.response.OrderListResponse;
import com.md.youyouhui.net.response.PayMealResponse;
import com.md.youyouhui.net.response.QuestionResponse;
import com.md.youyouhui.net.response.RegisterResponse;
import com.md.youyouhui.net.response.ShowResponse;
import com.md.youyouhui.net.response.UserCardResponse;
import com.md.youyouhui.net.response.UserInfoResponse;

import java.util.List;

import okhttp3.RequestBody;

/**
 * Created by AdministratorZJ
 * on 2018/5/25.
 */

public class MainViewModel extends ViewModel {

    public LiveData<Resource<RegisterResponse>> register(String phone, String vcode, String pwd, String source, String inviterNumber) {
        return UserRepo.newInstance().register(phone, vcode, pwd, source, inviterNumber);
    }

    public LiveData<Resource<CodeResponse>> sendCode(String tel) {
        return CodeRepo.newInstance().sendCode(tel);
    }

    public LiveData<Resource<CodeResponse>> sendCodeV2(String tel,String token,String imgcode) {
        return CodeRepo.newInstance().sendCodeV2(tel,token,imgcode);
    }

    public LiveData<Resource<LoginResponse>> login(int type, String phone, String vcode, String pwd, String source) {
        return LoginRepo.newInstance().login(type, phone, vcode, pwd, source);
    }

    public LiveData<Resource<Object>> logout() {
        return LogoutAccountRepo.newInstance().logoutAccount();
    }

    public LiveData<Resource<Object>> forgot(String phone, String vcode, String pwd) {
        return ForgotRepo.newInstance().forgot(phone, vcode, pwd);
    }

    public LiveData<Resource<Object>> modifyPhone(String phone, String vcode) {
        return MobilePhoneRepo.newInstance().modifyPhone(phone, vcode);
    }

    public LiveData<Resource<Object>> invitePeople(String registerMobilePhone, String invitePhone) {
        return InvitePeopleRepo.newInstance().invitePeople(registerMobilePhone, invitePhone);
    }

    public LiveData<Resource<Object>> mobilePwd(String oldPwd, String newPwd) {
        return MobilePwdRepo.newInstance().mobilePwd(oldPwd, newPwd);
    }

    public LiveData<Resource<Object>> mobileName(String name) {
        return MobileNickNameRepo.newInstance().mobileName(name);
    }

    public LiveData<Resource<IndexResponse>> index(int page, int pagesize) {
        return IndexRepo.newInstance().index(page, pagesize);
    }

    public LiveData<Resource<HomeNewsResponse>> getNews(int page, int pagesize) {
        return HomeNewsRepo.newInstance().getNews(page, pagesize);
    }

    public LiveData<Resource<QuestionResponse>> question(int page, int pagesize) {
        return QuestionRepo.newInstance().question(page, pagesize);
    }

    public LiveData<Resource<UserCardResponse>> getUserCard(int page, int pagesize) {
        return UserCardRepo.newInstance().getUserCard(page, pagesize);
    }

    public LiveData<Resource<Object>> bindCard(String cardNo, String mobile, String name, int type) {
        return BindCardRepo.newInstance().bindCard(cardNo, mobile, name, type);
    }

    public LiveData<Resource<Object>> delUserCard(String id) {
        return DelCardRepo.newInstance().delUserCard(id);
    }

    public LiveData<Resource<PayMealResponse>> payMeal(int page, int pagesize) {
        return PayMealRepo.newInstance().payMeal(page, pagesize);
    }

    public LiveData<Resource<List<DirectPayResponse>>> directPay() {
        return DirectPayRepo.newInstance().directPay();
    }

    public LiveData<Resource<List<NoticeResponse>>> notice() {
        return NoticeRepo.newInstance().notice();
    }

    public LiveData<Resource<CouponResponse>> getCoupon(int page, int pagesize, int status) {
        return CouponRepo.newInstance().getCoupon(page, pagesize, status);
    }

    public LiveData<Resource<UserInfoResponse>> getUserInfo() {
        return UserInfoRepo.newInstance().getUserInfo();
    }

    public LiveData<Resource<Object>> setUserHead(RequestBody body) {
        return UserHeadRepo.newInstance().setUserHead(body);
    }

    public LiveData<Resource<GetCardNumResponse>> getCardNum() {
        return CardNumRepo.newInstance().getCardNum();
    }

    public LiveData<Resource<Object>> receiveCard(String consignee, String mobilePhone, String area, String detailedAddress, String postcode, int type,
                                                  String rechargeId, String couponId, int monthly, String totalPayAmount, String payType) {
        return ReceiveCardRepo.newInstance().receiveCard(consignee, mobilePhone, area, detailedAddress, postcode, type, rechargeId, couponId, monthly, totalPayAmount, payType);
    }

    public LiveData<Resource<List<CouponAvailableResponse>>> couponAvailable(String rechargeId, String usedAmount) {
        return CouponAvailableRepo.newInstance().couponAvailable(rechargeId, usedAmount);
    }

    public LiveData<Resource<Object>> payMoney(String qbId, String totalPayment, String accountOilCardId, String accountCouponId, String payType) {
        return PayMoneyRepo.newInstance().payMoney(qbId, totalPayment, accountOilCardId, accountCouponId, payType);
    }

    public LiveData<Resource<Object>> payMoneyMeal(String rechargeId, String totalPayment, int monthly, String accountOilCardId, String accountCouponId, String payType) {
        return PayMoneyMealRepo.newInstance().payMoneyMeal(rechargeId, totalPayment, monthly, accountOilCardId, accountCouponId, payType);
    }

    public LiveData<Resource<GetHomeMealResponse>> getHomeMeal() {
        return HomeMealRepo.newInstance().getHomeMeal();
    }

    public LiveData<Resource<List<GetHomeMealNewResponse>>> getHomeMealNew() {
        return HomeMealNewRepo.newInstance().getHomeMealNew();
    }

    public LiveData<Resource<ShowResponse>> getShow() {
        return ShowRepo.newInstance().show();
    }

    public LiveData<Resource<List<GetOrderInfoResponse>>> getOrderInfo(String orderType) {
        return OrderInfoRepo.newInstance().getOrderInfo(orderType);
    }

    public LiveData<Resource<GetOilInfoResponse>> getOilInfo(String city) {
        return OilInfoRepo.newInstance().getOilInfo(city);
    }

    public LiveData<Resource<List<GetTypeResponse>>> getShoppingType() {
        return GetTypeRepo.newInstance().getShoppingType();
    }

    public LiveData<Resource<List<GetSlideResponse>>> getSlide() {
        return GetSlideRepo.newInstance().getSlide();
    }

    public LiveData<Resource<List<GetSellResponse>>> getShoppingSell() {
        return GetSellRepo.newInstance().getShoppingSell();
    }

    public LiveData<Resource<List<GetLimitSellResponse>>> getShoppingLimitSell() {
        return GetLimitSellRepo.newInstance().getShoppingLimitSell();
    }

    public LiveData<Resource<List<GetShoppingInfoResponse>>> getShoppingInfo(String categoryId) {
        return GetShoppingInfoRepo.newInstance().getShoppingInfo(categoryId);
    }

    public LiveData<Resource<GetShoppingDetailsResponse>> getShoppingDetails(String categoryId) {
        return GetShoppingDetailsRepo.newInstance().getShoppingDetails(categoryId);
    }

    public LiveData<Resource<Object>> addAddress(String id, String consignee, String mobilePhone, String area, String detailedAddress, String postcode, String tag) {
        return AddAddressRepo.newInstance().addAddress(id, consignee, mobilePhone, area, detailedAddress, postcode, tag);
    }

    public LiveData<Resource<List<GetAddressResponse>>> getAddress() {
        return GetAddressRepo.newInstance().getAddress();
    }

    public LiveData<Resource<Object>> delAddress(String id) {
        return DelAddressRepo.newInstance().delAddress(id);
    }

    public LiveData<Resource<GetAddressResponse>> getDefaultAddress() {
        return GetDefaultAddressRepo.newInstance().getDefaultAddress();
    }

    public LiveData<Resource<Object>> shoppingPay(String giId, String addressId, String payType) {
        return ShoppingPayRepo.newInstance().shoppingPay(giId, addressId, payType);
    }

    public LiveData<Resource<List<OrderListResponse>>> getShoppingOrders(String type, String statusType) {
        return GetShoppingOrdersRepo.newInstance().getShoppingOrders(type, statusType);
    }

    public LiveData<Resource<Object>> orderConfrim(String type, String orderId) {
        return OrderConfrimRepo.newInstance().orderConfrim(type, orderId);
    }

    public LiveData<Resource<OrderDetailResponse>> getOrderInfoDetail(String orderId, String orderType) {
        return OrderDetailRepo.newInstance().getOrderInfoDetail(orderId, orderType);
    }
}
